package cn.wolfcode.luowowo.service.impl;

import cn.wolfcode.luowowo.common.query.PlaneTicketQueryObject;
import cn.wolfcode.luowowo.flight.domain.PlaneTicket;
import cn.wolfcode.luowowo.flight.mapper.PlaneTicketMapper;
import cn.wolfcode.luowowo.flight.service.IFlightService;
import com.alibaba.dubbo.config.annotation.Service;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

@Service
public class FlightServiceImpl implements IFlightService {
    @Autowired
    private PlaneTicketMapper planeTicketMapper;

    public List<PlaneTicket> list() {
        return planeTicketMapper.selectAll();
    }

    public PageInfo<PlaneTicket> query(PlaneTicketQueryObject qo) {
        PageHelper.startPage(qo.getCurrentPage(), qo.getPageSize());
        return new PageInfo<PlaneTicket>(planeTicketMapper.selectForList(qo));
    }
}
